﻿<%@ Page Language="C#" MasterPageFile="~/share/AdminMasterPage.Master" AutoEventWireup="true"
    CodeBehind="ResetPassword.aspx.cs" Inherits="AKMII.DMRA.Web.ResetPassword" Title="Agent Lead Order & Delivery System" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="LinkContent" runat="server">
    <a id="breadcrumb_home" href="#">Home</a>&nbsp;&gt;&nbsp; <a id="A1" href="javascript:void(0);">
        Admin Home Page</a>&nbsp;&gt;&nbsp; <a id="A2" href="javascript:void(0);">Reset Password</a>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="DetailsContent" runat="server">
<script type="text/javascript">
   function $(id)
    {
        return document.getElementById("ctl00_DetailsContent_"+id);
    }
    function SelectAll()
    {
        var table=$("GridView1");
        var headbox=document.getElementById("chbHead");
        var checkboxs=table.getElementsByTagName("input");
        for(var i=0;i<checkboxs.length;i++)
        {
            if(checkboxs[i].type=="checkbox")
            {
                if(headbox.checked)
                {
                    checkboxs[i].checked=true;
                }
                else
                {
                     checkboxs[i].checked=false;
                }
            }
        }
    }
    
    function UnselectAll()
    {
        var table=$("GridView1");
        var headbox=document.getElementById("chbHead");
        var checkboxs=table.getElementsByTagName("input");
        for(var i=0;i<checkboxs.length;i++)
        {
            if(checkboxs[i].type=="checkbox")
            {

                checkboxs[i].checked=false;

            }
        }
    }
    
    function CheckSelected()
    {
        var table=$("GridView1");
        var sum=0;
        if(confirm("Are you sure?"))
        {
        for(var j=1;j<table.rows.length;j++)
        {
            var checkboxs=table.rows[j].getElementsByTagName("input"); 
            for(var i=0;i<checkboxs.length;i++)
            {
                if(checkboxs[i].type=="checkbox"&&!checkboxs[i].disabled)
                {
                    if(checkboxs[i].checked)
                    {
                        sum++;
                    }
                }
            }
        }
        if(sum==0)
        {
            alert("You should select one MD at least before Reset!");
            return false;
        }
        }
        else
        {
            return false;
        }
    }
    </script>
    <div class="addmd">
        <asp:Button ID="btnCommit" CssClass="loginbuttonBtn"  runat="server" 
            Text="Reset Password(s)" onclick="btnCommit_Click" OnClientClick="return CheckSelected();" />
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="button" id="btnCancel" onclick="UnselectAll();" class="loginbuttonBtn" value="Cancel" /></div>
        <br />
    <div id="specialcontentContainnerDiv" class="specialcontentContainnerDiv">
        <asp:GridView ID="GridView1" Width="98%" AllowPaging="true" PageSize="100" 
            CssClass="leadtable" runat="server" AutoGenerateColumns="false"
            onpageindexchanging="GridView1_PageIndexChanging" BorderWidth="1px">
            <HeaderStyle CssClass="ItemListHeaderRow" />
            <Columns>
                   <asp:TemplateField>
                    <ItemStyle CssClass="subheader22" />
                    <HeaderStyle CssClass="BorderLeft22" />
                    <HeaderTemplate>
                       <input type="checkbox" onclick="SelectAll();" id="chbHead" />
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:CheckBox ID="chbReset" runat="server"  />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField HeaderText="MD ID" HeaderStyle-CssClass="BorderLeft22" ItemStyle-CssClass="subheader22"
                    DataField="ID" />
                <asp:BoundField HeaderText="First Name" HeaderStyle-CssClass="BorderLeft22" ItemStyle-CssClass="subheader22"
                    DataField="FirstName" />
                <asp:BoundField HeaderText="Last Name" HeaderStyle-CssClass="BorderLeft22" ItemStyle-CssClass="subheader22"
                    DataField="LastName" />
                <asp:BoundField HeaderText="Email" HeaderStyle-CssClass="BorderLeft22" ItemStyle-CssClass="subheader22"
                    DataField="Email" />
            </Columns>
            <EmptyDataTemplate>
                <table class="leadtable" cellspacing="0" border="1" style="width: 100%;">
                    <tr class="ItemListHeaderRow">
                        <th class="BorderLeft22">
                            <input type="checkbox" />
                        </th>
                        <th class="BorderLeft22">
                            MD ID
                        </th>
                        <th class="BorderLeft22" >
                            First Name
                        </th>
                        <th class="BorderLeft22" >
                            Last Name
                        </th>
                        <th class="BorderLeft22">
                            Email
                        </th>
                    </tr>
                    <tr>
                        <td class="subheader22" colspan="25">
                          There is no record!
                        </td>
                    </tr>
                    </table>
            </EmptyDataTemplate>
        </asp:GridView>
    </div>
</asp:Content>
